package com.xckj.controller.configuration;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import com.xckj.entity.MethodClass4caller;
import com.xckj.service.MethodClass4callerService;

/**
 * @description 向下调用链配置
 * @author yanchf
 * @date 2023-12-09
 */
@RestController
@RequestMapping(value = "/methodClass4caller")
public class MethodClass4callerController {

    @Resource
    private MethodClass4callerService methodClass4callerService;

    /**
    * 新增
    * @author yanchf
    * @date 2023/12/09
    **/
    @RequestMapping("/insert")
    public Object insert(MethodClass4caller methodClass4caller){
        return methodClass4callerService.insert(methodClass4caller);
    }

    /**
    * 刪除
    * @author yanchf
    * @date 2023/12/09
    **/
    @RequestMapping("/delete")
    public Object delete(int id){
        return methodClass4callerService.delete(id);
    }

    /**
    * 更新
    * @author yanchf
    * @date 2023/12/09
    **/
    @RequestMapping("/update")
    public Object update(MethodClass4caller methodClass4caller){
        return methodClass4callerService.update(methodClass4caller);
    }

    /**
    * 查询 根据主键 id 查询
    * @author yanchf
    * @date 2023/12/09
    **/
    @RequestMapping("/load")
    public Object load(int id){
        return methodClass4callerService.load(id);
    }

    /**
    * 查询 分页查询
    * @author yanchf
    * @date 2023/12/09
    **/
    @RequestMapping("/pageList")
    public Map<String, Object> pageList(@RequestParam(required = false, defaultValue = "0") int offset,
                                        @RequestParam(required = false, defaultValue = "10") int pagesize) {
        return methodClass4callerService.pageList(offset, pagesize);
    }

}